\RequirePackage {keycommand}

\ExplSyntaxOn
\NewDocumentCommand{\DndDeprecate}{ mmm }
  {
    \__dnd_deprecated:nnn {#1} {#2} {#3}
  }
\ExplSyntaxOff

% Either hilariously, or infuriatingly, the \ifcommandkey
% implementation is buggy. Here is a re-implementation
% from tex.stackexchange.
\begingroup
  \makeatletter
  \catcode`\/=8 %
  \@firstofone
    {
      \endgroup
      \renewcommand{\ifcommandkey}[1]{%
        \csname @\expandafter \expandafter \expandafter
        \expandafter \expandafter \expandafter  \expandafter
        \kcmd@nbk \commandkey {#1}//{first}{second}//oftwo\endcsname
      }
  }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndcolors.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Sets the themecolor and colors for all themed elements
% If called without the optional color, resets the color of all themed elements to the current themecolor
\newcommand{\setthemecolor}[1][themecolor]{%
  \DndDeprecate{\noexpand\setthemecolor}{1.0.0}{Use \noexpand\DndSetThemeColor to set the theme color.}%
  \colorlet{themecolor}{#1}
  \colorlet{commentcolor}{#1}
  \colorlet{sidebarcolor}{#1}
  \colorlet{tablecolor}{#1}
}

% Backwards-compatible aliases and colours
\colorlet {commentgreen}  {PhbLightGreen}
\colorlet {itemtablepink} {DmgCoral}
\colorlet {monstertan}    {statblockbg}
\definecolor {monstertandark} {HTML} {F0DBB5}

% Old interface
\colorlet {commentboxcolor} {commentcolor}
\colorlet {paperboxcolor}   {sidebarcolor}
\colorlet {quoteboxcolor}   {readaloudcolor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndcomment.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Usage \begin{commentbox}[options]{title}[color]
\ExplSyntaxOn
\DeclareTColorBox{commentbox}{O{} m O{commentboxcolor}}{%
  before~upper={%
    \bool_if:NT \l__dnd_layout_bool
      {
        \bool_if:NF \l__dnd_justified_bool
          { \RaggedRight }
      }
  },
  code={\DndDeprecate{\noexpand\commentbox}{1.0.0}{Use~\noexpand\DndComment~for~breakable~comment~boxes.}\linespread{.9}},
  frame~hidden,
  boxrule=0pt,
  breakable,
  enhanced,
  before~skip=13pt plus 4pt minus 4pt,
  toptitle=2pt,
  boxsep=3pt,
  left=6pt,
  right=6pt,
  top=0pt,
  bottom=2pt,
  sharp~corners,
  fonttitle=\DndFontCommentTitle,
  fontupper=\DndFontCommentBody,
  fontlower=\DndFontCommentBody,
  title={#2},
  parbox=false,
  colback=#3,
  colbacktitle=#3,
  coltitle=black,
  after~skip=13pt plus 4pt minus 4pt,
  #1
}
\ExplSyntaxOff

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndmonster.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Fancy DnD 5e stat block rule
\newcommand{\dndline}{%
  \DndDeprecate{\noexpand\dndline}{1.0.0}{Use \noexpand\DndMonsterLine for stat block rules.}%
  \noindent
  \begin{tikzpicture}[]
    \draw [rulered, fill=rulered] (0, 0) --(0,0.1) -- (\textwidth, 0.05);
  \end{tikzpicture}%
  \par%
}

\RequirePackage{fp}
\RequirePackage{xstring}

% Macro to print stats with auto-computed modifier
% e.g. \stat{12} prints "12 (+1)"
\newcommand{\stat}[1]{%
  \DndDeprecate{\noexpand\stat}{1.0.0}{Use \noexpand\DndMonsterAbilityScores for the stat block ability score table.}%
  \FPeval{\mod}{(#1 - 10)/2}%
  \FPifpos\mod%
  \FPeval{\mod}{clip(trunc(mod,0))}#1\ (+\mod)%
  \else%
  \FPeval{\mod}{clip(abs(trunc(mod-0.5,0)))}#1\ (--\mod)%
  \fi%
}

% Macro to print avarage dice based value
% e.g. \dice{2d6+3} prints "10 (2d6 + 3)"
\newcommand{\dice}[1]{%
  \DndDeprecate{\noexpand\dice}{1.0.0}{Use \noexpand\DndDice to typeset a dice roll with the average value.}%
  \StrSubstitute{#1}{ }{}[\DiceArg]%				strip whitespaces
  \StrCut{\DiceArg}{d}\DiceNum\DiceSides%			split string
  \StrCut{\DiceSides}{+}\DiceSides\DiceAddMod%
  \StrCut{\DiceSides}{-}\DiceSides\DiceSubMod%
  \FPeval{\DiceAvg}{(\DiceSides+1)/2*\DiceNum}%	calculate avg roll
  \IfInteger{\DiceAddMod}{%
    \FPadd{\DiceAvg}{\DiceAvg}{\DiceAddMod}%	add value
    \def\DiceMod{ + \DiceAddMod}%
  }{%
    \IfInteger{\DiceSubMod}{%
      \FPsub{\DiceAvg}{\DiceAvg}{\DiceSubMod}%	subtract value
      \def\DiceMod{ -- \DiceSubMod}%
    }{%
      \def\DiceMod{}%
    }%
  }%
  \FPtrunc{\DiceAvg}{\DiceAvg}{0}%				round down
  \FPprint{\DiceAvg\ (\DiceNum \dname\DiceSides\DiceMod)}%
}

% Stat block without the background
\newtcolorbox{monsterboxnobg}[2][]{
  enhanced,
  code={\DndDeprecate{\noexpand\monsterboxnobg}{1.0.0}{Use \noexpand\DndMonsterNoBg for stat blocks without a background.}},
  frame hidden,
  boxrule=0pt,
  breakable,
  parbox=false,
  boxsep=0pt,
  toptitle=3mm,
  left=0pt,
  right=0pt,
  sharp corners,
  opacityback=0,
  colframe=titlered,
  fonttitle=\DndFontStatBlockTitle,
  fontupper=\DndFontStatBlockBody,
  fontlower=\DndFontStatBlockBody,
  title=#2,
  coltitle=titlered,
  #1
}

% Stat block with background
\newtcolorbox{monsterboxbg}[2][]{
  enhanced,
  code={\DndDeprecate{\noexpand\monsterboxbg}{1.0.0}{Use \noexpand\DndMonsterBg for stat blocks with a background.}},
  frame hidden,
  before skip=12pt plus 3pt minus 3pt,
  boxrule=0pt,
  breakable,
  parbox=false,
  boxsep=2pt,
  toptitle=8pt,
  top=0pt,
  left=2pt,
  right=2pt,
  bottom=7pt,
  sharp corners,
  oversize=0pt,
  borderline north={3pt}{0pt}{titlered},
  borderline north={2pt}{0.5pt}{statblockribbon},
  borderline south={3pt}{0pt}{titlered},
  borderline south={2pt}{0.5pt}{statblockribbon},
  colback=statblockbg,
  colbacktitle=statblockbg,
  colframe=titlered,
  fonttitle=\DndFontStatBlockTitle,
  coltitle=titlered,
  fontupper=\DndFontStatBlockBody,
  fontlower=\DndFontStatBlockBody,
  title=#2,
  #1
}

\ExplSyntaxOn
\bool_if:NTF \l__dnd_show_background_bool
  {
    \let\monsterbox\monsterboxbg%
    \let\endmonsterbox\endmonsterboxbg%
  }
  {
    \let\monsterbox\monsterboxnobg%
    \let\endmonsterbox\endmonsterboxnobg%
  }

\ExplSyntaxOff

% Define Monster subsection header style
\newcommand{\monstersection}[1]{%
  \DndDeprecate{\noexpand\monstersection}{1.0.0}{Use \noexpand\DndMonsterSection for stat blocks sections.}%
  \begingroup
    \par\medskip\noindent
    \DndFontStatBlockSection #1
    % \rule is a horizontal command, so placing it under the title incurs extra
    % line spacing. Use \hrule (a vertical command) instead.
    \vspace{3pt}
    \hrule height 0.6pt
    \vspace{2pt}
  \endgroup%
}

\NewDocumentEnvironment{monsteraction}{o}{%
  \DndDeprecate{\noexpand\monsteraction}{1.0.0}{Use \noexpand\DndMonsterAction for stat block actions.}%
  \IfValueTF{#1}{%
    \par\medskip\noindent\emph{\textbf{#1.}}%
  }{\unskip}%
}{\par}

% A description variant used to list creature attributes.
\newlist{dnd@monsterattrs}{description}{1}

\ExplSyntaxOn

\setlist[dnd@monsterattrs]{
  before=\color{titlered},
  font=\DndFontStatBlockBody,
  labelsep=\l__dnd_space_dim,
  noitemsep,
  nosep,
}

\ExplSyntaxOff

% A dnd@monsterattrs helper macro that always displays an attribute.
\newcommand{\dnd@monsterattr}[2]{%
  \item[#2] \commandkey{#1}
}

% A dnd@monsterattrs helper macro that displays an attribute if the user defined
% it.
\newcommand{\dnd@ifmonsterattr}[2]{%
  \ifcommandkey{#1}{%
    \item[#2] \commandkey{#1}
  }{}%
}

%
% Macros for use within the monster environment
%
\newkeycommand\basics[armorclass=0, hitpoints=0, speed=0]{%
  \DndDeprecate{\noexpand\basics}{1.0.0}{Use \noexpand\DndMonsterBasics for stat block AC, HP, and speed.}%
  \begin{dnd@monsterattrs}
    \dnd@monsterattr{armorclass}{\armorclassname}
    \dnd@monsterattr{hitpoints}{\hitpointsname}
    \dnd@monsterattr{speed}{\speedname}
  \end{dnd@monsterattrs}%
}

% Taubular enviornment for stats-block
\newkeycommand\stats[%
  STR=\stat{10},
  DEX=\stat{10},
  CON=\stat{10},
  INT=\stat{10},
  WIS=\stat{10},
  CHA=\stat{10}]{%
  \DndDeprecate{\noexpand\stats}{1.0.0}{Use \noexpand\DndMonsterAbilityScores for the stat block ability score table.}%
  \begingroup%
    \color{titlered}%
    \par\vspace{5pt}\noindent%
    \begin{tabularx}{\linewidth}{YYYYYY}
      \textbf{\strstatname} &
      \textbf{\dexstatname} &
      \textbf{\constatname} &
      \textbf{\intstatname} &
      \textbf{\wisstatname} &
      \textbf{\chastatname} \\
      \commandkey{STR} &
      \commandkey{DEX} &
      \commandkey{CON} &
      \commandkey{INT} &
      \commandkey{WIS} &
      \commandkey{CHA}
    \end{tabularx}%
    \par\vspace{4pt}%
  \endgroup%
}

\newkeycommand\details[
  skills=,
  damageimmunities=,
  savingthrows=,
  conditionimmunities=,
  damageresistances=,
  damagevulnerabilities=,
  senses=---,
  languages=---,
  challenge=1,
  ]{%
  \DndDeprecate{\noexpand\details}{1.0.0}{Use \noexpand\DndMonsterDetails for stat block details like resistances and CR.}%
  \begin{dnd@monsterattrs}
    \dnd@ifmonsterattr{savingthrows}{\savesname}
    \dnd@ifmonsterattr{skills}{\skillsname}
    \dnd@ifmonsterattr{damagevulnerabilities}{\dvulname}
    \dnd@ifmonsterattr{damageresistances}{\dresname}
    \dnd@ifmonsterattr{damageimmunities}{\dimmname}
    \dnd@ifmonsterattr{conditionimmunities}{\cimmname}
    \dnd@monsterattr{senses}{\sensesname}
    \dnd@monsterattr{languages}{\languagesname}
    \item[\challengename] \DndCRExp{\commandkey{challenge}}
  \end{dnd@monsterattrs}%
}

\ExplSyntaxOn
\newcommand{\dnd@hit}[1]{%
  \__dnd_caption:nn {\tohitname} {#1}
}
\ExplSyntaxOff

\newcommand{\dnd@damage}[2]{%
  \commandkey{#1}\ \commandkey{#2}\ \damagename%
}

\newcommand{\dnd@ifplusdmg}[2]{%
  \ifcommandkey{#1}{%
    { }\plusname\ \commandkey{#1}\ \commandkey{#2}\ \damagename%
  }{}%
}
\newcommand{\dnd@ifordmg}[5]{%
  \ifcommandkey{#1}{%
    , \orname\ \commandkey{#1}\ \commandkey{#2}\ \damagename\dnd@ifplusdmg{#4}{#5}\ \commandkey{#3}%
  }{}%
}

\newkeycommand+[\|]\monstermelee[
    name=Club,
    mod=+0,
    reach=5,
    targets=\defaulttargetsname,
    dmg=\dice{1d4},
    dmgtype=bludgeoning,
    plusdmg=,
    plusdmgtype=,
    ordmg=,
    ordmgwhen=,
    extra=,
  ]{%
  |\monsterattack|[
    name={\commandkey{name}},
    type=melee,
    mod={\commandkey{mod}},
    reach={\commandkey{reach}},
    targets={\commandkey{targets}},
    dmg={\commandkey{dmg}},
    dmgtype={\commandkey{dmgtype}},
    plusdmg={\commandkey{plusdmg}},
    plusdmgtype={\commandkey{plusdmgtype}},
    ordmg={\commandkey{ordmg}},
    ordmgwhen={\commandkey{ordmgwhen}},
    extra={\commandkey{extra}},
  ]
}
\newkeycommand+[\|]\monsterranged[
    name=Shortbow,
    mod=+0,
    range=80/320,
    targets=\defaulttargetsname,
    dmg=\dice{1d6},
    dmgtype=piercing,
    plusdmg=,
    plusdmgtype=,
    ordmg=,
    ordmgwhen=,
    extra=,
  ]{%
  |\monsterattack|[
    name={\commandkey{name}},
    type=ranged,
    mod={\commandkey{mod}},
    range={\commandkey{range}},
    targets={\commandkey{targets}},
    dmg={\commandkey{dmg}},
    dmgtype={\commandkey{dmgtype}},
    plusdmg={\commandkey{plusdmg}},
    plusdmgtype={\commandkey{plusdmgtype}},
    ordmg={\commandkey{ordmg}},
    ordmgwhen={\commandkey{ordmgwhen}},
    extra={\commandkey{extra}},
  ]
}

\newkeycommand\monsterattack[
    name=Dagger,
    enum* type={both,melee,ranged},
    mod=+0,
    reach=5,
    range=20/60,
    targets=\defaulttargetsname,
    dmg=\dice{1d4},
    dmgtype=piercing,
    plusdmg=,
    plusdmgtype=,
    ordmg=,
    ordmgwhen=,
    extra=,
  ]{%
  \DndDeprecate{\noexpand\monsterattack}{1.0.0}{Use \noexpand\DndMonsterMelee, \noexpand\DndMonsterRanged, or \noexpand\DndMonsterAttack for attacks that are melee, ranged, or both, respectively.}%
  \begin{monsteraction}[\commandkey{name}]
    \IfStrEqCase{\commandkey{type}}{%
      {melee}{\textit{\DndCaption{\meleeattackname}{\weaponname}:} \dnd@hit{mod}, \reachname\ \commandkey{reach} \unitsname}%
      {ranged}{\textit{\DndCaption{\rangedattackname}{\weaponname}:} \dnd@hit{mod}, \rangename\ \commandkey{range} \unitsname}%
      {both}{\textit{\DndCaption{\meleeorrangedattackname}{\weaponname}:} \dnd@hit{mod}, \reachname\ \commandkey{reach} \unitsname\ \orname\ \rangename\ \commandkey{range} \unitsname}%
    }[]%
    , \commandkey{targets}.
    \textit{\hitname:} \dnd@damage{dmg}{dmgtype}%
    \dnd@ifplusdmg{plusdmg}{plusdmgtype}%
    \dnd@ifordmg{ordmg}{dmgtype}{ordmgwhen}{plusdmg}{plusdmgtype}%
    \ifcommandkey{extra}{\commandkey{extra}}{}.
  \end{monsteraction}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndpaperbox.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Usage \begin{paperbox}[options]{title}[color]
\ExplSyntaxOn
\DeclareTColorBox{paperbox}{O{} m O{paperboxcolor}}{%
  before~upper={%
    \bool_if:NT \l__dnd_layout_bool
      {
        \bool_if:NF \l__dnd_justified_bool
          {\RaggedRight}
      }
  },
  code={\DndDeprecate{\noexpand\paperbox}{1.0.0}{Use \noexpand\DndSidebar for sidebars.}\linespread{.9}},
  frame~hidden,
  boxrule=0pt,
  enhanced,
  before~skip=13pt plus 4pt minus 4pt,
  toptitle=2pt,
  boxsep=3pt,
  left=6pt,
  right=6pt,
  top=0pt,
  bottom=3pt,
  fonttitle=\DndFontSidebarTitle,
  fontupper=\DndFontSidebarBody,
  fontlower=\DndFontSidebarBody,
  title={#2},
  sharp~corners,
  parbox=false,
  borderline~north={1pt}{-0.5pt}{black},
  borderline~south={1pt}{-0.5pt}{black},
  colback=#3,
  colbacktitle=#3,
  coltitle=black,
  fuzzy~shadow={0mm}{-3.5pt}{-0.5pt}{0.4mm}{black!60!white},
  overlay={%
    \fill[black] (frame.south~west) -- ++ (7pt,0) -- ++ (0,-5pt) -- cycle;
    \fill[black] (frame.north~west) -- ++ (7pt,0) -- ++ (0,5pt) -- cycle;
    \fill[black] (frame.north~east) -- ++ (-7pt,0) -- ++ (0,5pt) -- cycle;
    \fill[black] (frame.south~east) -- ++ (-7pt,0) -- ++ (0,-5pt) -- cycle;
    },
  after~skip=14pt plus 4pt minus 4pt,
  #1
}
\ExplSyntaxOn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndquote.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Usage \begin{quotebox}[options][color]
\ExplSyntaxOn
\DeclareTColorBox{quotebox}{O{} O{quoteboxcolor}}{%
  before~upper={%
    \bool_if:NT \l__dnd_layout_bool
      {
        \bool_if:NF \l__dnd_justified_bool
          {\RaggedRight}
      }
  },
  code={\DndDeprecate{\noexpand\quotebox}{1.0.0}{Use~\noexpand\DndReadAloud~for~read-aloud~text.}\linespread{1.1}},
  enhanced~jigsaw,
  frame~hidden,
  boxrule=0pt,
  breakable,
  enhanced,
  before~skip=13pt plus 4pt minus 4pt,
  boxsep=8pt,
  top=0pt,
  left=0pt,
  right=0pt,
  bottom=0pt,
  colback=#2,
  sharp~corners,
  parbox=false,
  borderline~west={1pt}{-0.5pt}{titlered},
  borderline~east={1pt}{-0.5pt}{titlered},
  fontupper=\DndFontReadAloud,
  fontlower=\DndFontReadAloud,
  overlay={%
    \foreach\n in {north~east,north~west,south~east,south~west}
    {\draw[titlered, fill=titlered] (frame.\n) circle (1.5pt); }; },
  after~skip=13pt plus 4pt minus 4pt,
  #1
}
\ExplSyntaxOff

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndsections.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Special command for magic items, traps, and the like.
\newcommand{\subtitlesection}[2]{%
  \DndDeprecate{\noexpand\subtitlesection}{1.0.0}{Use \noexpand\DndItemHeader for item headers.}%
  \subsubsection{#1}%
  \textit{#2}
  \par\vspace{3pt plus 1pt minus 1pt}\noindent\ignorespaces}

% Map Areas and their References

% Labelling helpers
\newcommand{\AreaLabel@Prefix}{area}
\newcommand{\SetAreaLabelPrefix}[1]{%
\renewcommand{\AreaLabel@Prefix}{#1}}

\newcounter{Area}
\newcommand\ResetAreas{%
  \DndDeprecate{\noexpand\ResetAreas}{1.0.0}{Use \noexpand\DndResetAreas to reset area counters.}%
  \setcounter{Area}{0}
}

\NewDocumentCommand\area{mo}{%
  \DndDeprecate{\noexpand\area}{1.0.0}{Use \noexpand\DndArea to typeset a section with an area counter.}%
  \refstepcounter{Area}%
  \IfNoValueTF{#2}%
    {\label{\AreaLabel@Prefix:#1}}%
    {\label{\AreaLabel@Prefix:#2}}%
  \subsection{\arabic{Area}. #1}%
}

% defines sub-areas, like '5a', '5b'
\newcounter{SubArea}[Area]

\NewDocumentCommand\subarea{mo}{%
  \DndDeprecate{\noexpand\subarea}{1.0.0}{Use \noexpand\DndSubArea to typeset a section with an sub-area counter.}%
  \refstepcounter{SubArea}%
  \IfNoValueTF{#2}%
    {\label{\AreaLabel@Prefix:#1}}%
    {\label{\AreaLabel@Prefix:#2}}%
  \subsubsection{\arabic{Area}\alph{SubArea}. #1}%
}

% sub area references should be '5a', '5b', not '1', '2'
\renewcommand\p@SubArea{\arabic{Area}}
\renewcommand\theSubArea{\alph{SubArea}}

\newcounter{DetailArea}[subsection]
\newcommand{\DetailArea@Prefix}{}
\newcommand{\SetDetailAreaPrefix}[1]{\renewcommand{\DetailArea@Prefix}
      {#1--\arabic{DetailArea}\par\expandafter\ignorespaces\noindent}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndspell.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\spellheader}[6]{%
  \DndDeprecate{\noexpand\spellheader}{1.0.0}{Use \noexpand\DndSpellHeader to typeset a spell header.}%
  \subtitlesection{#1}{#2}
  \begin{description}[noitemsep,nosep,after=\smallskip,leftmargin=1em]
    \item[\spellcastingtimename:] #3
    \item[\spellrangename:] #4
    \item[\spellcomponentsname:] #5
    \item[\spelldurationname:] #6
  \end{description}
}

\newenvironment{spell}[6]
  {\spellheader{#1}{#2}{#3}{#4}{#5}{#6}}
  % Environment encloses description.
{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% dndtable.sty - to be removed in version 1.0.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Table Header
\newcommand{\header}[1]{%
\begingroup%
\par\vspace{10pt plus 3 pt minus 3pt}%
\noindent%
\DndFontTableTitle%
#1%
\endgroup%
}

% Table Environment
\NewDocumentEnvironment{dndtable}{O{XX} O{tablecolor}}{%
  \DndDeprecate{\noexpand\dndtable}{1.0.0}{Use \noexpand\DndTable for tables.}%
  \par\vspace{2pt plus 1pt minus 1pt}%
  \noindent%
  \DndFontTableBody%
  \setlength{\extrarowheight}{3pt}%
  \rowcolors{1}{}{#2}%
  \tabularx{\linewidth}{#1}%
}{%
  \endtabularx%
  \par\vspace{10pt plus 3 pt minus 3pt}%
}
